import cv2
import json
import os
import pdb

json_dir = '/data/lzy/tile_round1_train_20201231/coco/annotations/instances_train2017.json'
image_dir = '/data/lzy/tile_round1_train_20201231/coco/train2017/'
json2_dir = '/data/lzy/tile_round1_train_20201231/train_annos.json'
save_dir = '/data/lzy/tile_round1_train_20201231/vis'
with open(json2_dir) as f:
    annos2=json.load(f)
with open(json_dir) as f:
    annos=json.load(f)
# pdb.set_trace()
c = 0
for i in range(len(annos2)):
    anno=annos2[i]
    name = anno['name']
    img_path = os.path.join(image_dir, name)
    if(name == '253_40_t20201130123650449_CAM1.jpg'):
        print(anno)
    coors = anno['bbox']
    x1 = (int(coors[0]), int(coors[1]))
    x2 = (int(coors[2]), int(coors[3]))


